package com.gwnet.rider.controller;


import com.gwnet.common.core.domain.ResponseResult;
import com.gwnet.rider.domain.RiderResignation;
import com.gwnet.rider.domain.bo.RiderResignationApplyBO;
import com.gwnet.rider.service.RiderResignationService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 骑手离职表 前端控制器
 * </p>
 *
 * @author WangLiang
 * @since 2024-08-09
 */
@RestController
@RequestMapping("/riderResignation")
public class RiderResignationController {

    private final RiderResignationService resignationService;

    public RiderResignationController(RiderResignationService resignationService) {
        this.resignationService = resignationService;
    }




    /**
     * 根据ID获取详情
     * @param resignation
     * @return
     */
    @PostMapping("/view")
    public ResponseResult<RiderResignation> view(@RequestBody RiderResignation resignation){
        RiderResignation riderResignation = resignationService.getById(resignation.getResignationId());
        return ResponseResult.success(riderResignation);
    }

    /**
     * 申请离职
     * @param applyBO
     * @return
     */
    @PostMapping("/applyResignation")
    public ResponseResult<Boolean> applyResignation(@RequestBody RiderResignationApplyBO applyBO){
        Boolean flag = resignationService.applyResignation(applyBO);
        return ResponseResult.success(flag);
    }

    /**
     * 提交审核
     * @param resignation
     * @return
     */
    @PostMapping("/submit")
    public ResponseResult<Boolean> submit(@RequestBody RiderResignation resignation){
        Boolean flag = resignationService.submit(resignation);
        return ResponseResult.success(flag);
    }

    /**
     * 平台审核通过
     * @param resignation
     * @return
     */
    @PostMapping("/pass")
    public ResponseResult<Boolean> pass(@RequestBody RiderResignation resignation){
        Boolean flag = resignationService.pass(resignation);
        return ResponseResult.success(flag);
    }








}

